import time
import datetime

class l_time():
    def __init__(self, parent=None):
        pass
    
    def gettime(self):
        data001 = time.strftime("%Y-%m-%d", time.localtime())
        data002 = time.strftime("%H:%M:%S", time.localtime())
        data003 = data001 + " " + data002
        return data003
    
    def gettime_rss(self,tambah=0):
        #data001 = time.strftime("%Y-%m-%d", time.localtime())
        #data002 = time.strftime("%H:%M:%S", time.localtime())
        #data003 = data001 + " " + data002
        data = time.strftime("%a, %d %b %Y %H:%%d:%S GMT", time.gmtime())%(int(time.strftime("%M", time.gmtime())) + int(tambah))
        return data
    
    def getnow(self):
        data = datetime.datetime.now()
        return data
    
    def getseconds(self):
        data001 = time.strftime("%H:%M:%S", time.localtime())
        data002 = str(data001).split(":")
        
        data_hour = int(data002[0]) * 3600
        data_min = int(data002[1]) * 60
        data_sec = int(data002[2]) 
        
        data_time = data_hour + data_min + data_sec
        
        return data_time
    
    def getdate(self):
        data001 = time.strftime("%Y-%m-%d", time.localtime())
        data002 = str(data001).split("-")
        return data002
    
    def setseconds(self, data):
        #data = time.strftime("%H:%M:%S", time.localtime()) #for test only, this is direct example
        data001 = str(data).split(":")
        
        data_hour = int(data001[0]) * 3600
        data_min = int(data001[1]) * 60
        data_sec = int(data001[2]) 
        
        data_time = data_hour + data_min + data_sec
        
        return data_time
    
    def setdate(self, data):
        data001 = str(data).split("-")
        return data001
    
if __name__ == '__main__':
    myapp = l_time()
    print myapp.getdate()
    print myapp.gettime()
    print myapp.gettime_rss()